//
//  BaiXiBaoViewController.m
//  SingleDemoForAAChartKit
//
//  Created by 蓓蕾 on 2021/8/20.
//

#import "BaiXiBaoViewController.h"
#import <AAChartKit.h>

@interface BaiXiBaoViewController ()

@property (nonatomic, strong) AAChartView *aaChartView;

@property (nonatomic, strong) AAChartModel *aaChartModel;

@property (nonatomic, strong) AAOptions *aaChartOption;

@end

@implementation BaiXiBaoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    NSLog(@"开始了");



    _aaChartView = [[AAChartView alloc]init];
    _aaChartView.frame = CGRectMake(10, 80, kScreenWidth - 20, 300);
    _aaChartView.scrollEnabled = NO;//是否允许滚动
    //_aaChartView.scrollEnabled = NO;
    [self.view addSubview:_aaChartView];
    _aaChartModel = [self configureMixedLineChart];
//    _aaChartOption = [self configureAAPlotBandsForChart];
    [_aaChartView aa_drawChartWithChartModel:_aaChartModel];
//    [_aaChartView aa_drawChartWithOptions:_aaChartOption];
}

- (AAChartModel *)configureMixedLineChart {
    return AAChartModel.new
    .chartTypeSet(AAChartTypeLine)
//    .connectNullsSet(true)
    .markerRadiusSet(@0)//隐藏连接点
    .subtitleSet(@"虚拟数据")
    .categoriesSet(@[
        @"Java", @"Swift", @"Python", @"Ruby", @"PHP"
                   ])
    .yAxisTitleSet(@"摄氏度")
    .colorsThemeSet(@[@"#000000",@"#000000"])
//    .dataLabelsEnabledSet(true)
    .yAxisGridLineStyleSet([AALineStyle styleWithWidth:@0])
    .seriesSet(@[
        AASeriesElement.new
        .nameSet(@"本专业")
        .dataSet(@[@45, @88, @49, @43, @70])
        .zoneAxisSet(@"x")
        .enableMouseTrackingSet(@NO)//折线图是否允许交互
        .showInLegendSet(NO)
        .lineWidthSet(@2)
        .zonesSet(@[
            AAZonesElement.new
            .valueSet(@2)
            .dashStyleSet(AAChartLineDashStyleTypeDot)
                  ]),
        AASeriesElement.new
        .nameSet(@"所有专业")
        .enableMouseTrackingSet(@NO)//折线图是否允许交互
        .showInLegendSet(NO)//是否显示图例，只针对本折线图有效
        .lineWidthSet(@2)
        .dataSet(@[@45, @88])
               ]);
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
